#ifndef XGE_GRAPHICS_ROOT_H_
#define XGE_GRAPHICS_ROOT_H_
#include "xge_common_config.h"
#include "node_basenode.h"
#include "xdata_structure.h"
#include "g_colors.h"
#include "xallocator.h"

namespace xge{
namespace window{
  class GraphicsWindow;
}
namespace graphics{
  class SceneManager;
  class RenderTargetNode;
  // RootNode is a a window that everything will finally render on
  // It is always the real window so it contains no target as 
  // default  
  class RootNode : public ListBaseNode , public Allocator {
  public:
    // Since the root node will rendering all the things to the
    // graphics window , this function will return the pointer to
    // the graphics window !
    window::GraphicsWindow* GetGraphicsWindow() const ;
  private:
    // CTor and DTor
    RootNode() ;
    virtual ~RootNode() {}
  protected:
    // This function will be called by the SceneManager
    virtual void OnPaint( const Timer::tick_t& diff_time );
  public:  
    virtual void set_color( const Color& color , size_t index )  {
      color_ = color;
    }
    virtual const Color color( size_t index ) const {
      return color_;
    }
  private:
    friend class SceneManager;
    friend class BaseNode;
    Color color_;
  };

}// namespace graphics
}// namespace xge

#endif// XGE_GRAPHICS_ROOT_H_